package Cy.Servlet;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import Cy.DAO.ReceivingDAO;
import Factory.ReceivingFactory;

/**
 * Servlet implementation class DeletereceivingServlet
 */
@WebServlet("/deletereceiving")
public class DeletereceivingServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
	private ReceivingDAO receivingDAO = ReceivingFactory.createDAO();
	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		request.setCharacterEncoding("utf-8");
		response.setContentType("text/html;charset=utf-8");
		PrintWriter out = response.getWriter();
		int oid = Integer.parseInt(request.getParameter("oid"));
		String erorr = receivingDAO.deletereceiving(oid);
		out.println(erorr);
	}

}
